package com.demo.lifeinfo.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.demo.lifeinfo.entity.Product;
import com.demo.lifeinfo.model.GlideApp;
import com.demo.lifeinfo.model.XPImageLoader;
import com.jaeger.ninegridimageview.NineGridImageViewAdapter;
import com.lxj.xpopup.XPopup;

import java.util.List;

/**
 * created by Raymond
 * on 2019-04-24
 */
public class MyNineImageAdapter extends NineGridImageViewAdapter<String> {


    @Override
    protected void onDisplayImage(Context context, ImageView imageView, String s) {
        GlideApp.with(context).load(s).centerCrop().into(imageView);
    }

    @Override
    protected void onItemImageClick(Context context, ImageView imageView, int index, List<String> list) {
        super.onItemImageClick(context, imageView, index, list);
        new XPopup.Builder(context)
                .asImageViewer((ImageView) imageView, list.get(index), -1, -1, 50, false, new XPImageLoader())
                .show();
    }
}
